package com.hello.messagelistener;

import com.Constants;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.core.MessageListener;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

import java.io.UnsupportedEncodingException;

@Component
public class ConsumerMessageListener implements MessageListener {

    @Override
    public void onMessage(Message message) {
        System.out.println("----enter----");
        String payload = null;
        try {
            payload = new String(message.getBody(), "UTF-8");
        } catch (UnsupportedEncodingException e) {
            e.printStackTrace();
        }
        System.out.println("payload = " + payload);
    }
}
